#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	int count = 0;
	int c = a;
	while (c <= b) {
		while (c > 0) {
			int n = c % 10;
			if (n == 2)
				count++;
			c /= 10;
		}
		c = ++a;
	}
	cout << count;
}
